import { CoolController, BaseController, CoolUrlTag, TagTypes } from '@cool-midway/core';
import { Body, Inject, Post, Get, Query } from '@midwayjs/core';
import { GameLevelPlayerEntity } from '../../entity/player'; 
import { GameLevelPlayerService } from '../../service/player'; 
import { GameLevelInfoEntity } from '../../entity/info';
import { UserInfoEntity } from '../../../user/entity/info';

/**
 * game模块-关卡解锁信息
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: GameLevelPlayerEntity,
  service: GameLevelPlayerService,
  pageQueryOp: {
      fieldEq: ['levelId', 'playerId'],
      select: ['a.*', 'b.name as levelName','c.avatarUrl as playerAvatar', 'c.nickName as playerNickname'],
      join: [
        {
          entity: GameLevelInfoEntity,
          alias: 'b',
          condition: 'a.levelId = b.id',
          type: 'leftJoin',
        },
        {
          entity: UserInfoEntity,
          alias: 'c',
          condition: 'a.playerId = c.id',
          type: 'leftJoin',
        }
      ],
    }
})
export class AdminGamePlayerController extends BaseController {
    @Inject()
    gameLevelInfoService: GameLevelPlayerService;

}
